package com.superm.controller;

import com.superm.entity.RepostoryType;
import com.superm.entity.WarehouseExit;
import com.superm.entity.WarehouseExitPoJo;
import com.superm.service.RepostoryService;
import com.superm.service.WarehouseExitService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 采购退货出库单
 */
@Controller
@RequestMapping("/WarehouseExit")
public class WarehousExitController {


    @Autowired
    private WarehouseExitService warehouseExitService;

    @Autowired
    private RepostoryService repostoryService;
    /**
     * 跳转到查询采购出库单
     * @return
     */
    @RequestMapping("/skipWarehousExit")
    public ModelAndView skipWarehousExit(){
        ModelAndView mv = new ModelAndView("WarehouseExit/warehousExitList");
        //查询所有仓库
        List<RepostoryType> repostoryTypes =  repostoryService.allRepostory();
        mv.addObject("repostoryTypes",repostoryTypes);
        return mv;
    }

    /**
     * 模糊查询采购退货出库单
     * @return
     */
    @RequestMapping("/likeWarehousExit")
    @ResponseBody
    public Map<String,Object> likeWarehousExit(WarehouseExitPoJo warehouseExitPoJo, @RequestParam("page") Integer pageNo,@RequestParam("limit") Integer pageSize){
       Map<String,Object> map =  warehouseExitService.likeWarehouseExit(warehouseExitPoJo,pageNo,pageSize);
        return map;
    }
}
